…unit specializations
Both writeUnitValue() implementations already guard against calling
toStandardUnit()/fromStandardUnit() on an InconvertibleUnitDatatype
for the propertys own matched unit (the dbpedia#630 fix in
SimplePropertyMapping, and the top-level check in CalculateMapping).
But both also separately loop over context.ontology.specializations
-- a per-class override of the property range, independent of the
propertys own unit -- and call fromStandardUnit() on whatever
specificPropertyUnit that lookup returns, unconditionally. Currency
units (usDollar, euro, poundSterling, japaneseYen, russianRouble,
unitedArabEmiratesDirham, ...) are registered as
InconvertibleUnitDatatype in OntologyDatatypes.scala, so a class
specializing a dimension property (e.g. a money amount) to one of
these currencies hits the exact same always-throws
fromStandardUnit()/UnsupportedOperationException("Tried to convert
inconvertible unit") this time regardless of whether the property own
matched unit was convertible.
Skip writing that specific-class property when its specialized unit
is inconvertible, consistent with how the property own unit is
already handled, rather than crash or fabricate a value with no
meaningful standard-unit basis.
Related to dbpedia#582
Problem
Both
SimplePropertyMapping.writeUnitValueandCalculateMapping.writeUnitValuealready guard against callingtoStandardUnit()/fromStandardUnit()on anInconvertibleUnitDatatypefor the property's own matched unit — the#630fix inSimplePropertyMapping, and the top-levelunit.isInstanceOf[InconvertibleUnitDatatype]check inCalculateMapping(the latter addressed for the conversion itself in #853).But both functions also separately loop over
context.ontology.specializations— a per-class override of the property's range, looked up independently of the property's own unit — and callfromStandardUnit()on whateverspecificPropertyUnitthat lookup returns, unconditionally:Currency units (
usDollar,euro,poundSterling,japaneseYen,russianRouble,unitedArabEmiratesDirham, ...) are registered asInconvertibleUnitDatatypeinOntologyDatatypes.scala. So a class that specializes a dimension property (e.g. a money amount like budget/revenue) to one of these currencies hits the exact same always-throwsfromStandardUnit()→UnsupportedOperationException("Tried to convert inconvertible unit")— the same failure reported in #582 — regardless of whether the property's own matched unit was convertible.SimplePropertyMappingis the common, everyday property-mapping path (used for any infobox property with a unit/dimension range), so this is plausibly the dominant real-world trigger for that exception, more so than the narrowerCalculateMappingpath fixed in #853.Fix
Skip writing that specific-class property when its specialized unit is inconvertible, consistent with how the property's own unit is already handled — there's no meaningful "standard unit" basis to convert a currency amount from, so fabricating a value would be as wrong as crashing.
Related to #582 (same failure, different/more common trigger than #853).
Summary by CodeRabbit